package cn.xopencode.securityservice.provider.suggest;

import cn.xopencode.common.framework.vo.CommonResult;
import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.securityservice.rpc.suggest.SuggestRpc;
import cn.xopencode.securityservice.rpc.suggest.dto.SuggestCreateReqDTO;
import cn.xopencode.securityservice.rpc.suggest.dto.SuggestPageReqDTO;
import cn.xopencode.securityservice.rpc.suggest.dto.SuggestRespDTO;
import cn.xopencode.securityservice.service.suggest.SuggestService;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import static cn.xopencode.common.framework.vo.CommonResult.success;

/**
 * 创新与合理化建议 Rpc 实现
 */
@DubboService(version = "${dubbo.provider.SuggestRpc.version}")
public class SuggestRpcProviderImpl implements SuggestRpc {
    @Autowired
    private SuggestService suggestService;

    @Override
    public CommonResult<Integer> createSuggest(SuggestCreateReqDTO createDTO) {
        return success(suggestService.createSuggest(createDTO));
    }

    @Override
    public CommonResult<PageResult<SuggestRespDTO>> pageSuggest(SuggestPageReqDTO pageDTO) {
        return success(suggestService.pageSuggest(pageDTO));
    }

    @Override
    public CommonResult<SuggestRespDTO> getSuggest(String suggestId) {
        return success(suggestService.getSuggest(suggestId));
    }
}
